<template>
    <div class="FormView">
        <ObjectView ref="ObjectForm" :Model="Config000001" :DefaultValue="DefaultValue" Type="Default" :Level="0" />
    </div>

    <div class="buttonView" @click="GetObjectForm">获取数据</div>
</template>
<script setup>
import Config000001 from './TestConfig/000001'
import Config000002 from './TestConfig/000002'
import ObjectView from './Items/ObjectView.vue';
import Dict from './TestConfig/Dict'
import { provide, ref } from 'vue'

const ObjectForm = ref();

const DefaultValue = {
    name: 'ABC',
    id: 'asdasdasdasd'
}

const ModelMapping = {
    '000001': Config000001,
    '000002': Config000002
}

const GetObjectForm = function () {
    var Data = ObjectForm.value.GetValue();
    console.log(Data);
}

const GetDict = async function (key) {
    return Dict[key]
}
const GetModel = async function (key) {
    return ModelMapping[key]
}

provide('GetDict', GetDict);
provide('GetModel', GetModel);


</script>
<style lang="less" scoped>
.buttonView {
    width: 100px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 4px;
    background-color: cadetblue;
    cursor: pointer;
}

.FormView {
    width: 600px;
    padding: 20px;
}

:deep(.ant-form-item) {
    margin-bottom: 10px;
}
</style>